package com.example.practical_training_projects.controller;
import com.example.practical_training_projects.entity.test2;
import com.example.practical_training_projects.service.test2Service;
import com.example.practical_training_projects.service.test3Service;
import com.example.practical_training_projects.vo.votest2class;
import com.example.practical_training_projects.vo.votest3class;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.example.practical_training_projects.entity.test3;
import java.util.List;
@RestController
@CrossOrigin //允许跨域执行
@RequestMapping("test3")
public class test3Controller {@Autowired
private test3Service service;

    @GetMapping("/list")
    public List<votest3class> findAlltest3Andclass(Integer ts_uid, String t3_context){
        return service.findtest3BycontextAndclassuid(ts_uid,t3_context);
    }
    //分页
    @GetMapping("/page")
    public PageInfo<votest3class> gettestpage(Integer pageNum, Integer pageSize){
        PageInfo<votest3class> pageInfo = service.findtestpage(pageNum,pageSize);
        return pageInfo;
    }

    @GetMapping("/del/{t3_uid}")
    public  Integer deleteTest3(@PathVariable("t3_uid") Integer t3_uid){
        return service.deleteTest3(t3_uid);
    }

    @PostMapping("add")
    public Integer insertTest3(@RequestBody test3 t3_uid) {
        //@RequestBody能接收转换的字符串，匹配到StudentInfo studentInfo中
        return service.insertTest3(t3_uid);
    }

    @GetMapping("/get/{t3_uid}")
    public test3 findTest3uid(@PathVariable("t3_uid") Integer t3_uid){
        return service.findTest3uid(t3_uid);
    }

    @PostMapping("update")
    public Integer updateTest3(@RequestBody test3 test3){
        return service.updateTest3(test3);
    }

    @GetMapping("/query/{context}")
    public List<test3> getContext3(@PathVariable("context")String t3_context){
        return service.getContest3(t3_context);
    }

//    @GetMapping("/find/{class}")
//    public List<test2> getClass(@PathVariable("class")String t_class){
//        return service.getClass(t_class);
//    }

    @GetMapping("Find/{id}")
    public  List<votest3class> findAlltest3Andclass(@PathVariable("id") Integer t3_uid){
        return service.findAlltest3Andclass();
    }
}
